<%- include('../layout') %>

<% contentFor('body') { %>
<% currentPath = '/categories' %>
<div class="container-fluid">
  <div class="d-flex justify-content-between align-items-center mb-4">
    <h2>编辑分类</h2>
    <a href="/admin/categories" class="btn btn-secondary">返回列表</a>
  </div>
  
  <div class="card">
    <div class="card-body">
      <form action="/admin/categories/edit/<%= category.id %>" method="post">
        <div class="mb-3">
          <label class="form-label">分类ID</label>
          <input type="text" class="form-control" value="<%= category.id %>" disabled>
          <small class="form-text text-muted">分类ID不可修改</small>
        </div>
        <div class="mb-3">
          <label for="name" class="form-label">分类名称 *</label>
          <input type="text" class="form-control" id="name" name="name" value="<%= category.name %>" required>
        </div>
        <div class="mb-3">
          <label for="icon" class="form-label">图标（可选）</label>
          <input type="text" class="form-control" id="icon" name="icon" value="<%= category.icon || '' %>" placeholder="如：fa-paw">
          <small class="form-text text-muted">请输入Font Awesome图标类名，如：fa-paw, fa-dog, fa-cat等</small>
        </div>
        <div class="mb-3">
          <label for="color" class="form-label">颜色 *</label>
          <input type="text" class="form-control" id="color" name="color" value="<%= category.color %>" required>
          <small class="form-text text-muted">请输入十六进制颜色值，如：#198754（绿色）</small>
        </div>
        <div class="d-flex gap-2">
          <button type="submit" class="btn btn-primary">保存</button>
          <a href="/admin/categories" class="btn btn-secondary">取消</a>
        </div>
      </form>
    </div>
  </div>
</div>
<% } %>